/**
 * 
 */
package com.dalonedrow.module.osric.rpg;

import com.dalonedrow.globalvariables.constants.hq.GlobalConstants;
import com.dalonedrow.rpg.base.flyweights.EquipmentItemModifier;
import com.dalonedrow.rpg.base.flyweights.IOEquipItem;

/**
 * @author Donald
 */
public final class OSRICIOEquipItem implements IOEquipItem {
	/** the list of equipment modifiers. */
	private EquipmentItemModifier[]	elements;
	/** Creates a new instance of {@link OSRICIOEquipItem}. */
	public OSRICIOEquipItem() {
		elements =
				new EquipmentItemModifier[GlobalConstants.IO_EQUIPITEM_ELEMENT_NUMBER
				                          ];
		for (int i = 0; i < elements.length; i++) {
			elements[i] = new EquipmentItemModifier();
		}
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void free() {
		for (int i = 0; i < elements.length; i++) {
			elements[i] = null;
		}
	}
	@Override
	public EquipmentItemModifier getElement(final int index) {
		return elements[index];
	}
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void reset() {
		for (int i = 0; i < elements.length; i++) {
			elements[i].clearData();
		}
	}
}
